﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Windows7.Location;
using Windows7.Sensors;

namespace SensorTstMg
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnGetLoc_Click(object sender, EventArgs e)
        {
            Guid[] reportGuids = { typeof(Windows7.Location.LatLongLocationReport).GUID };
            LocationProvider.RequestPermissions(this.Handle, true, reportGuids);

            LatLongLocationProvider llProv = new LatLongLocationProvider(1000);
            LocationReport report = llProv.GetReport();

            double lat = (double) report.GetValue(
                SensorPropertyKeys.SENSOR_DATA_TYPE_LATITUDE_DEGREES);
            double lon = (double) report.GetValue(
                SensorPropertyKeys.SENSOR_DATA_TYPE_LONGITUDE_DEGREES);            
        }
    }
}
